import Vue from 'vue'
import VueRouter from 'vue-router'

// import Login from '@/views/Login'
// import Layout from '@/views/Layout'
// import Home from '@/views/Home'
// import User from '@/views/User'
// import Demo from '@/demo/slot'
// import Search from '@/views/Search'
// import SearchResult from '@/views/Search/SearchResult'
// import ArticleDetail from '@/views/ArticleDetail'
// import UserEdit from '@/views/User/UserEdit'
// import Chat from '@/views/Chat'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    // component: Login
    component: () => import('@/views/Login')
  },
  {
    path: '/layout',
    // component: Layout,
    component: () => import('@/views/Layout'),
    redirect: '/layout/home',
    children: [
      {
        path: 'home',
        // component: Home
        component: () => import('@/views/Home'),
        meta: { isRecord: true, top: 0 } // isRecord是否需要设置滚动位置
      },
      {
        path: 'user',
        // component: User
        component: () => import('@/views/User')
      }
    ]
  },
  // {
  //   path: '/demo',
  //   component: Demo
  //   // component: () => import('@/views/demo/slot')
  // },
  {
    path: '/search',
    // component: Search
    component: () => import('@/views/Search')
  },
  {
    path: '/search/:keywords',
    // component: SearchResult
    component: () => import('@/views/Search/SearchResult')
  },
  {
    path: '/article_detail',
    // component: ArticleDetail
    component: () => import('@/views/ArticleDetail')
  },
  {
    path: '/user_editor',
    // component: UserEdit
    component: () => import('@/views/User/UserEdit')
  },
  {
    path: '/chat',
    // component: Chat
    component: () => import('@/views/Chat')
  }
]

const router = new VueRouter({
  routes
})

export default router
